package com.zhu.char06

/**
 *
 * @version 1.0
 * @author study
 * @date 2020/9/5 14:52
 *
 */
/**
 * 特质自身类型
 * 依赖注入
 *
 *
 */
object Scala21_TestTrait {

}

class User(var name: String, var age: Int)


trait UserDao {
  def insert(user: User) = {
    println(" insert into data" + user.name)
  }
}

class UserController {

  //1 实现依赖注入功能
  //  _: UserDao =>

  //注入多个的写法
  _: UserDao with Exception =>
  def regist(user: User): Unit = {
    insert(user)
  }
}
